package com.iot.ic.controller;

import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import com.iot.ic.base.BaseController;
import com.iot.ic.common.Response;
import com.iot.ic.model.AppVersion;
import com.iot.ic.service.AppVersionService;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;

@Api(description = "app版本更新相关接口")
@RestController
public class AppVersionController extends BaseController {
	
	@Autowired
	private AppVersionService appVersionService;
	
	/**
	 * 获取最新版本的app
	 * @param appVersion
	 * @return
	 */
	@ApiOperation(value="获得App最新版本", notes="")
	@ResponseBody
	@RequestMapping(value="/appVersions/lastVersion",method=RequestMethod.GET)
	public Response<Map<String, Object>> getLastVersion(@RequestParam Byte appType, @RequestParam int versionNo){
		AppVersion appVersion = new AppVersion();
		appVersion.setAppType(appType);
		appVersion.setVersionNo(versionNo);
		AppVersion result=appVersionService.getVersion(appVersion);
		Response response=new Response();
		response.setResult(result);
		return response;
	}

}
